package com.galeno.zoopeeper;

import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooKeeper;

import java.io.IOException;
import java.util.List;

/**
 * @author galeno @Title: @Description:
 * @date 2021/7/3016:47
 */
public class Demo1 {
  public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
    /**
     * 参数1:ZK集群的地址,可以写多个,增加可靠性,用,隔开
     * 参数2:连接超时持剑ms
     * 参数3 获取连接成功以后监听到 null */
    ZooKeeper zk = new ZooKeeper("galeno01:2181", 1000, null);
    /**
     * ls 获取 /节点下的所有的子节点
     */
    List<String> ls = zk.getChildren("/", null);
    System.out.println(ls);
    zk.close();
  }
}
